!function (t, e) {
    if ("object" == typeof exports && "object" == typeof module) module.exports = e(); else if ("function" == typeof define && define.amd) define([], e); else {
        var n = e();
        for (var o in n) ("object" == typeof exports ? exports : t)[o] = n[o]
    }
}(window, (function () {
    return function (t) {
        var e = {};

        function n(o) {
            if (e[o]) return e[o].exports;
            var i = e[o] = {i: o, l: !1, exports: {}};
            return t[o].call(i.exports, i, i.exports, n), i.l = !0, i.exports
        }

        return n.m = t, n.c = e, n.d = function (t, e, o) {
            n.o(t, e) || Object.defineProperty(t, e, {enumerable: !0, get: o})
        }, n.r = function (t) {
            "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {value: "Module"}), Object.defineProperty(t, "__esModule", {value: !0})
        }, n.t = function (t, e) {
            if (1 & e && (t = n(t)), 8 & e) return t;
            if (4 & e && "object" == typeof t && t && t.__esModule) return t;
            var o = Object.create(null);
            if (n.r(o), Object.defineProperty(o, "default", {
                enumerable: !0,
                value: t
            }), 2 & e && "string" != typeof t) for (var i in t) n.d(o, i, function (e) {
                return t[e]
            }.bind(null, i));
            return o
        }, n.n = function (t) {
            var e = t && t.__esModule ? function () {
                return t.default
            } : function () {
                return t
            };
            return n.d(e, "a", e), e
        }, n.o = function (t, e) {
            return Object.prototype.hasOwnProperty.call(t, e)
        }, n.p = "", n(n.s = 4)
    }([function (t, e, n) {
        var o, i, r, s = this && this.__extends || (r = function (t, e) {
            return (r = Object.setPrototypeOf || {__proto__: []} instanceof Array && function (t, e) {
                t.__proto__ = e
            } || function (t, e) {
                for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n])
            })(t, e)
        }, function (t, e) {
            function n() {
                this.constructor = t
            }

            r(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, new n)
        }), a = this && this.__awaiter || function (t, e, n, o) {
            return new (n || (n = Promise))((function (i, r) {
                function s(t) {
                    try {
                        c(o.next(t))
                    } catch (t) {
                        r(t)
                    }
                }

                function a(t) {
                    try {
                        c(o.throw(t))
                    } catch (t) {
                        r(t)
                    }
                }

                function c(t) {
                    var e;
                    t.done ? i(t.value) : (e = t.value, e instanceof n ? e : new n((function (t) {
                        t(e)
                    }))).then(s, a)
                }

                c((o = o.apply(t, e || [])).next())
            }))
        }, c = this && this.__generator || function (t, e) {
            var n, o, i, r, s = {
                label: 0, sent: function () {
                    if (1 & i[0]) throw i[1];
                    return i[1]
                }, trys: [], ops: []
            };
            return r = {
                next: a(0),
                throw: a(1),
                return: a(2)
            }, "function" == typeof Symbol && (r[Symbol.iterator] = function () {
                return this
            }), r;

            function a(r) {
                return function (a) {
                    return function (r) {
                        if (n) throw new TypeError("Generator is already executing.");
                        for (; s;) try {
                            if (n = 1, o && (i = 2 & r[0] ? o.return : r[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, r[1])).done) return i;
                            switch (o = 0, i && (r = [2 & r[0], i.value]), r[0]) {
                                case 0:
                                case 1:
                                    i = r;
                                    break;
                                case 4:
                                    return s.label++, {value: r[1], done: !1};
                                case 5:
                                    s.label++, o = r[1], r = [0];
                                    continue;
                                case 7:
                                    r = s.ops.pop(), s.trys.pop();
                                    continue;
                                default:
                                    if (!(i = (i = s.trys).length > 0 && i[i.length - 1]) && (6 === r[0] || 2 === r[0])) {
                                        s = 0;
                                        continue
                                    }
                                    if (3 === r[0] && (!i || r[1] > i[0] && r[1] < i[3])) {
                                        s.label = r[1];
                                        break
                                    }
                                    if (6 === r[0] && s.label < i[1]) {
                                        s.label = i[1], i = r;
                                        break
                                    }
                                    if (i && s.label < i[2]) {
                                        s.label = i[2], s.ops.push(r);
                                        break
                                    }
                                    i[2] && s.ops.pop(), s.trys.pop();
                                    continue
                            }
                            r = e.call(t, s)
                        } catch (t) {
                            r = [6, t], o = 0
                        } finally {
                            n = i = 0
                        }
                        if (5 & r[0]) throw r[1];
                        return {value: r[0] ? r[1] : void 0, done: !0}
                    }([r, a])
                }
            }
        };
        o = [n, e, n(1), n(2)], void 0 === (i = function (t, e, n, o) {
            "use strict";
            Object.defineProperty(e, "__esModule", {value: !0});
            var i = function (t) {
                function e(e, n) {
                    var i = t.call(this) || this;
                    return i._ws = null, i._fixHost = !1, i._port = 31e3, i._guid = new o.GUID, i._callbackMap = new Map, i._sessions = new Map, i._wsUrl = e || "ws://" + window.location.host + "/ws/signalling", i._fixHost = !!e, i._hostName = n || new URL(i._wsUrl).hostname, i.checkAlive_().then(), i
                }

                return s(e, t), Object.defineProperty(e.prototype, "serverIp", {
                    get: function () {
                        return this._hostName
                    }, enumerable: !0, configurable: !0
                }), Object.defineProperty(e.prototype, "port", {
                    get: function () {
                        return this._port
                    }, enumerable: !0, configurable: !0
                }), Object.defineProperty(e.prototype, "connected", {
                    get: function () {
                        return !(!this._ws || this._ws.readyState !== WebSocket.OPEN)
                    }, enumerable: !0, configurable: !0
                }), e.prototype.checkAlive_ = function () {
                    return a(this, void 0, void 0, (function () {
                        var t;
                        return c(this, (function (e) {
                            return this._ws && this._ws.readyState === WebSocket.OPEN || (console.log("尝试与流媒体信令服务建立连接"), t = new WebSocket(this._wsUrl), this._ws = t, t.addEventListener("open", this.onWSOpened_.bind(this)), t.addEventListener("message", this.onWSMessage_.bind(this)), t.addEventListener("error", this.onWSError_.bind(this)), t.addEventListener("close", this.onWSClose_.bind(this))), [2]
                        }))
                    }))
                }, e.prototype.onWSOpened_ = function () {
                    console.log("链接到流媒体信令服务:" + this._wsUrl), this._fixHost && this.sendMessage_(u.host, void 0, this._hostName)
                }, e.prototype.onWSError_ = function (t) {
                    console.log("与流媒体信令服务连接错误:" + this._wsUrl), this._ws.close()
                }, e.prototype.onWSClose_ = function (t) {
                    console.log("与流媒体信令服务连接关闭." + this._wsUrl), this._ws = null, setTimeout(this.checkAlive_.bind(this), 1e4)
                }, e.prototype.onWSMessage_ = function (t) {
                    try {
                        var e = JSON.parse(t.data);
                        e && (e.type == u.openSession ? this.procSession_(e) : e.type == u.error ? console.log("接收到流媒体服务错误消息:" + e.content) : this.transMessage_(e))
                    } catch (e) {
                        console.error("从流媒体信令服务接收消息异常:" + e + ";" + t.data)
                    }
                }, e.prototype.procSession_ = function (t) {
                    if (t.sessionId && t.content) {
                        var e = this._callbackMap.get(t.sessionId);
                        if (e) {
                            this._callbackMap.delete(t.sessionId);
                            var n = new r({signal: this, sessionId: t.content});
                            this._sessions.set(n.getSessionId(), n), n.on(r.EVENT_CLOSE, this.sessionClosed_, this), e(n)
                        }
                    }
                }, e.prototype.sessionClosed_ = function (t) {
                    this.sendMessage_(u.closeSession, t.getSessionId(), void 0), this._sessions.delete(t.getSessionId())
                }, e.prototype.transMessage_ = function (t) {
                    if (t.sessionId) {
                        var e = this._sessions.get(t.sessionId);
                        e && e.receiveMessage(t)
                    }
                }, e.prototype.sendMessage_ = function (t, e, n) {
                    if (this._ws && this._ws.readyState === WebSocket.OPEN) {
                        var o = {type: t, sessionId: e, content: n};
                        this._ws.send(JSON.stringify(o))
                    }
                }, e.prototype.createSession = function (t) {
                    if (this._ws && this._ws.readyState === WebSocket.OPEN) {
                        if (t) {
                            var e = this._guid.newGUID();
                            this._callbackMap.set(e, t), this.sendMessage_(u.openSession, e, void 0)
                        }
                    } else console.error("尚未连接Webrtc Signaling服务")
                }, e.prototype.closeSession = function (t) {
                    t && t.close()
                }, e.prototype.control = function (t, e, n) {
                    if (void 0 === n && (n = 4), t) {
                        var o = {command: e, speed: n}, i = {type: p.ptz, cameraId: t, content: o};
                        this.sendMessage_(u.control, void 0, i)
                    }
                }, e.prototype.controlStop = function (t) {
                    t && this.control(t, l.STOP)
                }, e.prototype.preset = function (t, e, n) {
                    if (t) {
                        var o = {command: e, index: n}, i = {type: p.preset, cameraId: t, content: o};
                        this.sendMessage_(u.control, void 0, i)
                    }
                }, e.prototype.toCoord = function (t, e, n, o, i) {
                    if (t) {
                        var r = {latitude: n, longitude: e, altitude: o, targetLength: i},
                            s = {cameraId: t, type: p.toCoord, content: r};
                        this.sendMessage_(u.control, void 0, s)
                    }
                }, e
            }(n.EventEmitter);
            e.WebrtcSignal = i;
            var r = function (t) {
                function e(e) {
                    var n = t.call(this) || this;
                    return n._closed = !1, n._signal = e.signal, n._sessionId = e.sessionId, n
                }

                return s(e, t), e.prototype.getSessionId = function () {
                    return this._sessionId
                }, e.prototype.isClosed = function () {
                    return this._closed
                }, e.prototype.receiveMessage = function (t) {
                    t.type == u.sdp ? this.procSDP_(t.content) : t.type == u.candidate ? this.procCandidate_(t.content) : t.type == u.status && this.procStatus_(t.content)
                }, e.prototype.procStatus_ = function (t) {
                    this.emit(e.EVENT_STATUS, t)
                }, e.prototype.procSDP_ = function (t) {
                    this._sdp = t, this.emit(e.EVENT_SDP, t)
                }, e.prototype.procCandidate_ = function (t) {
                    this._candi = t, this.emit(e.EVENT_CANDIDATE, t)
                }, e.prototype.sendSDP = function (t) {
                    this._signal.sendMessage_(u.sdp, this._sessionId, t)
                }, e.prototype.sendCandidate = function (t) {
                    this._signal.sendMessage_(u.candidate, this._sessionId, t)
                }, e.prototype.preview = function (t, e) {
                    if (this._closed) throw"会话已关闭";
                    if (t) {
                        this._cameraId = t;
                        var n = {cameraId: t, streamIndex: e};
                        this._signal.sendMessage_(u.preview, this._sessionId, n)
                    }
                }, e.prototype.control = function (t, e) {
                    if (void 0 === e && (e = 4), !this._cameraId) throw"未启动预览";
                    this._signal.control(this._cameraId, t, e)
                }, e.prototype.stopControl = function () {
                    if (!this._cameraId) throw"未启动预览";
                    this._signal.control(this._cameraId, l.STOP)
                }, e.prototype.preset = function (t, e) {
                    if (!this._cameraId) throw"未启动预览";
                    this._signal.preset(this._cameraId, t, e)
                }, e.prototype.toCoord = function (t, e, n, o) {
                    if (!this._cameraId) throw"未启动预览";
                    this._signal.toCoord(this._cameraId, t, e, n, o)
                }, e.prototype.close = function () {
                    this._closed || (this._cameraId = void 0, this._closed = !0, this.emit(e.EVENT_CLOSE, this)), this.removeAllListeners()
                }, e.EVENT_CLOSE = "close", e.EVENT_SDP = "sdp", e.EVENT_CANDIDATE = "candidate", e.EVENT_STATUS = "status", e
            }(n.EventEmitter);
            e.WebrtcSession = r;
            var l, u = function () {
                function t() {
                }

                return t.host = "host", t.openSession = "opensession", t.closeSession = "closesession", t.sdp = "sdp", t.candidate = "candidate", t.preview = "preview", t.control = "control", t.error = "error", t.status = "status", t
            }(), p = function () {
                function t() {
                }

                return t.ptz = "ptz", t.preset = "preset", t.toPTZ = "toptz", t.toCoord = "tocoord", t
            }();
            e.ControlCommandType = p, function (t) {
                t[t.STOP = 0] = "STOP", t[t.LIGHT_PWRON = 2] = "LIGHT_PWRON", t[t.WIPER_PWRON = 3] = "WIPER_PWRON", t[t.FAN_PWRON = 4] = "FAN_PWRON", t[t.HEATER_PWRON = 5] = "HEATER_PWRON", t[t.AUX_PWRON1 = 6] = "AUX_PWRON1", t[t.AUX_PWRON2 = 7] = "AUX_PWRON2", t[t.ZOOM_IN = 11] = "ZOOM_IN", t[t.ZOOM_OUT = 12] = "ZOOM_OUT", t[t.FOCUS_NEAR = 13] = "FOCUS_NEAR", t[t.FOCUS_FAR = 14] = "FOCUS_FAR", t[t.IRIS_OPEN = 15] = "IRIS_OPEN", t[t.IRIS_CLOSE = 16] = "IRIS_CLOSE", t[t.TILT_UP = 21] = "TILT_UP", t[t.TILT_DOWN = 22] = "TILT_DOWN", t[t.PAN_LEFT = 23] = "PAN_LEFT", t[t.PAN_RIGHT = 24] = "PAN_RIGHT", t[t.UP_LEFT = 25] = "UP_LEFT", t[t.UP_RIGHT = 26] = "UP_RIGHT", t[t.DOWN_LEFT = 27] = "DOWN_LEFT", t[t.DOWN_RIGHT = 28] = "DOWN_RIGHT", t[t.PAN_AUTO = 29] = "PAN_AUTO"
            }(l = e.PTZCommand || (e.PTZCommand = {})), function (t) {
                t[t.SET_PRESET = 8] = "SET_PRESET", t[t.CLE_PRESET = 9] = "CLE_PRESET", t[t.GOTO_PRESET = 39] = "GOTO_PRESET"
            }(e.PresetCommand || (e.PresetCommand = {})), function (t) {
                t[t.SPEED_1 = 1] = "SPEED_1", t[t.SPEED_2 = 2] = "SPEED_2", t[t.SPEED_3 = 3] = "SPEED_3", t[t.SPEED_4 = 4] = "SPEED_4", t[t.SPEED_5 = 5] = "SPEED_5", t[t.SPEED_6 = 6] = "SPEED_6", t[t.SPEED_7 = 7] = "SPEED_7"
            }(e.PTZSpeed || (e.PTZSpeed = {})), function (t) {
                t[t.unsupportedStream = 4001] = "unsupportedStream", t[t.unsupportedCommand = 4002] = "unsupportedCommand"
            }(e.SocStatusCode || (e.SocStatusCode = {}))
        }.apply(e, o)) || (t.exports = i)
    }, function (t, e, n) {
        var o, i = this && this.__spreadArrays || function () {
            for (var t = 0, e = 0, n = arguments.length; e < n; e++) t += arguments[e].length;
            var o = Array(t), i = 0;
            for (e = 0; e < n; e++) for (var r = arguments[e], s = 0, a = r.length; s < a; s++, i++) o[i] = r[s];
            return o
        };
        void 0 === (o = function (t, e) {
            "use strict";
            Object.defineProperty(e, "__esModule", {value: !0});
            var n = function () {
                function t() {
                    this._events = new Map
                }

                return t.prototype.getListeners_ = function (t) {
                    if (t) {
                        var e = this._events.get(t);
                        return e || (e = [], this._events.set(t, e), e)
                    }
                    return []
                }, t.prototype.removeListeners_ = function (t) {
                    t && this._events.delete(t)
                }, t.prototype.emit = function (t) {
                    for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
                    var o = this.getListeners_(t);
                    o.forEach((function (t) {
                        var n;
                        "function" == typeof t.func && (n = t.func).call.apply(n, i([t.caller], e))
                    }))
                }, t.prototype.on = function (t, e, n) {
                    e && this.getListeners_(t).push({func: e, caller: n})
                }, t.prototype.off = function (t, e, n) {
                    if (e) {
                        for (var o = this.getListeners_(t), i = 0; i < o.length; i++) {
                            if (o[i].func === e) {
                                o.splice(i, 1);
                                break
                            }
                        }
                        0 == o.length && this.removeListeners_(t)
                    }
                }, t.prototype.hasListener = function (t) {
                    if (t) {
                        var e = this._events.get(t);
                        if (e) return e.length > 0
                    }
                    return !1
                }, t.prototype.removeAllListeners = function () {
                    this._events = new Map
                }, t
            }();
            e.EventEmitter = n
        }.apply(e, [n, e])) || (t.exports = o)
    }, function (t, e, n) {
        var o;
        void 0 === (o = function (t, e) {
            "use strict";
            Object.defineProperty(e, "__esModule", {value: !0});
            var n = function () {
                function t() {
                    this.date = new Date
                }

                return t.prototype.newGUID = function () {
                    this.date = new Date;
                    for (var e = "", n = t.hexadecimal(this.getGUIDDate(), 16), o = t.hexadecimal(this.getGUIDTime(), 16), i = 0; i < 9; i++) e += Math.floor(16 * Math.random()).toString(16);
                    for (e += n, e += o; e.length < 32;) e += Math.floor(16 * Math.random()).toString(16);
                    return t.formatGUID(e)
                }, t.prototype.getGUIDDate = function () {
                    return this.date.getFullYear() + t.addZero(this.date.getMonth() + 1) + t.addZero(this.date.getDay())
                }, t.prototype.getGUIDTime = function () {
                    return t.addZero(this.date.getHours()) + t.addZero(this.date.getMinutes()) + t.addZero(this.date.getSeconds()) + t.addZero(parseInt(this.date.getMilliseconds() / 10 + ""))
                }, t.addZero = function (t) {
                    return "NaN" != Number(t).toString() && t >= 0 && t < 10 ? "0" + Math.floor(t) : t.toString()
                }, t.hexadecimal = function (t, e, n) {
                    return void 0 !== n ? parseInt(t, n).toString(e) : parseInt(t).toString(e)
                }, t.formatGUID = function (t) {
                    return t.slice(0, 8) + "-" + (t.slice(8, 12) + "-") + (t.slice(12, 16) + "-") + (t.slice(16, 20) + "-") + t.slice(20)
                }, t
            }();
            e.GUID = n
        }.apply(e, [n, e])) || (t.exports = o)
    }, function (t, e, n) {
        var o, i, r, s = this && this.__extends || (r = function (t, e) {
            return (r = Object.setPrototypeOf || {__proto__: []} instanceof Array && function (t, e) {
                t.__proto__ = e
            } || function (t, e) {
                for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n])
            })(t, e)
        }, function (t, e) {
            function n() {
                this.constructor = t
            }

            r(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, new n)
        }), a = this && this.__awaiter || function (t, e, n, o) {
            return new (n || (n = Promise))((function (i, r) {
                function s(t) {
                    try {
                        c(o.next(t))
                    } catch (t) {
                        r(t)
                    }
                }

                function a(t) {
                    try {
                        c(o.throw(t))
                    } catch (t) {
                        r(t)
                    }
                }

                function c(t) {
                    var e;
                    t.done ? i(t.value) : (e = t.value, e instanceof n ? e : new n((function (t) {
                        t(e)
                    }))).then(s, a)
                }

                c((o = o.apply(t, e || [])).next())
            }))
        }, c = this && this.__generator || function (t, e) {
            var n, o, i, r, s = {
                label: 0, sent: function () {
                    if (1 & i[0]) throw i[1];
                    return i[1]
                }, trys: [], ops: []
            };
            return r = {
                next: a(0),
                throw: a(1),
                return: a(2)
            }, "function" == typeof Symbol && (r[Symbol.iterator] = function () {
                return this
            }), r;

            function a(r) {
                return function (a) {
                    return function (r) {
                        if (n) throw new TypeError("Generator is already executing.");
                        for (; s;) try {
                            if (n = 1, o && (i = 2 & r[0] ? o.return : r[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, r[1])).done) return i;
                            switch (o = 0, i && (r = [2 & r[0], i.value]), r[0]) {
                                case 0:
                                case 1:
                                    i = r;
                                    break;
                                case 4:
                                    return s.label++, {value: r[1], done: !1};
                                case 5:
                                    s.label++, o = r[1], r = [0];
                                    continue;
                                case 7:
                                    r = s.ops.pop(), s.trys.pop();
                                    continue;
                                default:
                                    if (!(i = (i = s.trys).length > 0 && i[i.length - 1]) && (6 === r[0] || 2 === r[0])) {
                                        s = 0;
                                        continue
                                    }
                                    if (3 === r[0] && (!i || r[1] > i[0] && r[1] < i[3])) {
                                        s.label = r[1];
                                        break
                                    }
                                    if (6 === r[0] && s.label < i[1]) {
                                        s.label = i[1], i = r;
                                        break
                                    }
                                    if (i && s.label < i[2]) {
                                        s.label = i[2], s.ops.push(r);
                                        break
                                    }
                                    i[2] && s.ops.pop(), s.trys.pop();
                                    continue
                            }
                            r = e.call(t, s)
                        } catch (t) {
                            r = [6, t], o = 0
                        } finally {
                            n = i = 0
                        }
                        if (5 & r[0]) throw r[1];
                        return {value: r[0] ? r[1] : void 0, done: !0}
                    }([r, a])
                }
            }
        };
        o = [n, e, n(0), n(1)], void 0 === (i = function (t, e, n, o) {
            "use strict";
            Object.defineProperty(e, "__esModule", {value: !0});
            var i = function (t) {
                function e(e, n, o) {
                    void 0 === o && (o = 0);
                    var i = t.call(this) || this;
                    return i._playing = !1, i._streamIndex = 0, i._mstream = null, i._rtcSignal = e, i._cameraId = n, i._streamIndex = o, i
                }

                return s(e, t), Object.defineProperty(e.prototype, "playing", {
                    get: function () {
                        return this._playing
                    }, enumerable: !0, configurable: !0
                }), Object.defineProperty(e.prototype, "cameraId", {
                    get: function () {
                        return this._cameraId
                    }, enumerable: !0, configurable: !0
                }), Object.defineProperty(e.prototype, "streamIndex", {
                    get: function () {
                        return this._streamIndex
                    }, enumerable: !0, configurable: !0
                }), Object.defineProperty(e.prototype, "mediaStream", {
                    get: function () {
                        return this._mstream
                    }, enumerable: !0, configurable: !0
                }), e.prototype.sessionCreated_ = function (t) {
                    this._playing && this._cameraId ? (this._rtcSession = t, this._rtcSession.on(n.WebrtcSession.EVENT_SDP, this.onRemoteSDP_, this), this._rtcSession.on(n.WebrtcSession.EVENT_CANDIDATE, this.onRemoteCandidate_, this), this._rtcSession.on(n.WebrtcSession.EVENT_STATUS, this.onRemoteStatus_, this), this._rtcSession.preview(this._cameraId, this._streamIndex)) : t.close()
                }, e.prototype.onRemoteStatus_ = function (t) {
                    this.emit(e.EVENT_STATUS, t)
                }, e.prototype.onRemoteSDP_ = function (t) {
                    return a(this, void 0, void 0, (function () {
                        return c(this, (function (e) {
                            switch (e.label) {
                                case 0:
                                    return console.log("+++Remote SDP"), console.log(t), [4, this._rtcPeer.setRemoteDescription(t)];
                                case 1:
                                    return e.sent(), this._rtcPeer.createAnswer().then(this.onLocalAnswer_.bind(this)), [2]
                            }
                        }))
                    }))
                }, e.prototype.onRemoteCandidate_ = function (t) {
                    return a(this, void 0, void 0, (function () {
                        return c(this, (function (e) {
                            switch (e.label) {
                                case 0:
                                    return console.log("+++Remote Candidate"), console.log(t), [4, this._rtcPeer.addIceCandidate(t)];
                                case 1:
                                    return e.sent(), [2]
                            }
                        }))
                    }))
                }, e.prototype.onLocalAnswer_ = function (t) {
                    return a(this, void 0, void 0, (function () {
                        return c(this, (function (e) {
                            switch (e.label) {
                                case 0:
                                    return [4, this._rtcPeer.setLocalDescription(t)];
                                case 1:
                                    return e.sent(), this._rtcSession && (console.log("-------local SDP"), console.log(t), this._rtcSession.sendSDP(t)), [2]
                            }
                        }))
                    }))
                }, e.prototype.onLocalCandidate_ = function (t) {
                    var e = t.candidate;
                    e && this._rtcSession && (console.log("-------Local Candidate"), console.log(e), this._rtcSession.sendCandidate(e))
                }, e.prototype.onLocalAddSteam_ = function (t) {
                    this._mstream = t.stream, this.emit(e.EVENT_ONSTREAM, this._mstream)
                }, e.prototype.onLocalStateChange_ = function (t) {
                    var e = t.target;
                    console.log("Connection state changed:" + e.iceConnectionState)
                }, e.prototype.locate = function (t, e, n, o) {
                    this._rtcSession && this._rtcSession.toCoord(t, e, n, o)
                }, e.prototype.control = function (t, e) {
                    this._rtcSession && this._rtcSession.control(t, e)
                }, e.prototype.stopControl = function () {
                    this._rtcSession && this._rtcSession.stopControl()
                }, e.prototype.startPreview = function () {
                    if (!this._playing && this._cameraId) if (this._rtcSignal.connected) {
                        this._rtcSignal.createSession(this.sessionCreated_.bind(this));
                        var t = {};
                        this._rtcSignal.serverIp && void 0 !== this._rtcSignal.port && (t.iceServers = [{urls: "stun:" + this._rtcSignal.serverIp + ":" + this._rtcSignal.port + "?transport=udp"}]), this._rtcPeer = new RTCPeerConnection(t), this._rtcPeer.addEventListener("icecandidate", this.onLocalCandidate_.bind(this)), this._rtcPeer.addEventListener("addstream", this.onLocalAddSteam_.bind(this)), this._rtcPeer.addEventListener("iceconnectionstatechange", this.onLocalStateChange_.bind(this)), this._playing = !0
                    } else console.log("waiting to connecting video server"), this._replayTimer = setTimeout(this.startPreview.bind(this), 2e3)
                }, e.prototype.stopPreview = function () {
                    this._replayTimer && (clearTimeout(this._replayTimer), this._replayTimer = void 0), this._rtcPeer && (this._rtcPeer.close(), this._rtcPeer = void 0), this._rtcSession && (this._rtcSession.close(), this._rtcSession = void 0), this._mstream = null, this._playing = !1
                }, e.EVENT_ONSTREAM = "stream", e.EVENT_STATUS = "status", e
            }(o.EventEmitter);
            e.VideoClient = i
        }.apply(e, o)) || (t.exports = i)
    }, function (t, e, n) {
        var o, i;
        o = [n, e, n(5)], void 0 === (i = function (t, e, n) {
            "use strict";
            Object.defineProperty(e, "__esModule", {value: !0}), console.log("load ltvideoplayer plugin");
            var o = function () {
                function t() {
                }

                return t.prototype.init = function (t, e) {
                    this._fac = new n.VideoPlayerFactory(t, e)
                }, t.prototype.createPlayer = function (t, e) {
                    if (void 0 === e && (e = 0), this._fac) return this._fac.createPlayer(t, e);
                    throw new Error("LitongVideoPlayer has not been initialized!")
                }, t
            }();
            e.LitongVideoPlayer = new o
        }.apply(e, o)) || (t.exports = i)
    }, function (t, e, n) {
        var o, i;
        o = [n, e, n(6), n(8), n(0), n(9)], void 0 === (i = function (t, e, n, o, i) {
            "use strict";
            Object.defineProperty(e, "__esModule", {value: !0});
            var r = function () {
                function t(t, e) {
                    this._rtc = new i.WebrtcSignal(t, e), this._vcmgr = new o.VideoClientManager(this._rtc)
                }

                return t.prototype.createPlayer = function (t, e) {
                    void 0 === e && (e = 0);
                    var o = new n.VideoPlayer(this._vcmgr);
                    return t && o.startPreview(t, e), o
                }, t
            }();
            e.VideoPlayerFactory = r
        }.apply(e, o)) || (t.exports = i)
    }, function (t, e, n) {
        var o, i, r, s = this && this.__extends || (r = function (t, e) {
            return (r = Object.setPrototypeOf || {__proto__: []} instanceof Array && function (t, e) {
                t.__proto__ = e
            } || function (t, e) {
                for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n])
            })(t, e)
        }, function (t, e) {
            function n() {
                this.constructor = t
            }

            r(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, new n)
        });
        o = [n, e, n(0), n(3), n(1), n(7)], void 0 === (i = function (t, e, n, o, i, r) {
            "use strict";
            Object.defineProperty(e, "__esModule", {value: !0});
            var a = function (t) {
                function e(e) {
                    var n = t.call(this) || this;
                    return n._playing = !1, n._updateTime = new Date, n._lastHeight = 0, n._vcmgr = e, n._domEle = n.initUI_(), n._domLastFrame = n._domEle.getElementsByClassName("last-frame").item(0), n.monitorVideo_(), n
                }

                return s(e, t), Object.defineProperty(e.prototype, "dom", {
                    get: function () {
                        return this._domEle
                    }, enumerable: !0, configurable: !0
                }), Object.defineProperty(e.prototype, "playing", {
                    get: function () {
                        return this._playing
                    }, enumerable: !0, configurable: !0
                }), Object.defineProperty(e.prototype, "cameraId", {
                    get: function () {
                        return this._client && this._client.cameraId
                    }, enumerable: !0, configurable: !0
                }), Object.defineProperty(e.prototype, "streamIndex", {
                    get: function () {
                        return this._client && this._client.streamIndex || 0
                    }, enumerable: !0, configurable: !0
                }), e.prototype.initUI_ = function () {
                    var t = document.createElement("div");
                    t.classList.add("lt-video-container");
                    var e = document.createElement("video");
                    e.autoplay = !0, e.playsinline = !0, t.appendChild(e);
                    var n = document.createElement("img");
                    n.classList.add("last-frame"), n.alt = "", t.appendChild(n);
                    var o = document.createElement("div");
                    return o.classList.add("video-status"), t.appendChild(o), t
                }, e.prototype.fixLastFrame_ = function () {
                    var t = r.SnapshotPreview.toCanvas(this.getPlayer_());
                    this._domLastFrame.src = t.toDataURL("image/png"), this.updateVideoStatus_("视频重连中...")
                }, e.prototype.clearLastFrame_ = function () {
                    this._domLastFrame.src = "", "视频重连中..." === this._lastStatus && this.updateVideoStatus_("")
                }, e.prototype.monitorVideo_ = function () {
                    var t = this, n = this.getPlayer_();
                    n.addEventListener("play", (function () {
                        t.clearLastFrame_(), t._updateTime = new Date, t._aliveTimer = setTimeout(t.checkAlive_.bind(t), 5e3), t.stopReplayTimer_(), t._playing = !0, t.emit(e.EVENT_PLAY, t)
                    })), n.addEventListener("timeupdate", (function () {
                        t._updateTime = new Date, t.emit(e.EVENT_TIME_UPDATE, t)
                    })), n.addEventListener("abort", (function () {
                        t._playing = !1, t.emit(e.EVENT_ABORT, t)
                    }))
                }, e.prototype.checkAlive_ = function () {
                    (new Date).getTime() - this._updateTime.getTime() > 3e4 ? (this.fixLastFrame_(), this.restartReplay_()) : this._aliveTimer = setTimeout(this.checkAlive_.bind(this), 5e3)
                }, e.prototype.stopCheckAlive_ = function () {
                    this._aliveTimer && (clearTimeout(this._aliveTimer), this._aliveTimer = void 0)
                }, e.prototype.startReplayTimer_ = function () {
                    this.stopReplayTimer_(), this._replayTimer = setTimeout(this.restartReplay_.bind(this), 4e4)
                }, e.prototype.stopReplayTimer_ = function () {
                    this._replayTimer && (clearTimeout(this._replayTimer), this._replayTimer = void 0)
                }, e.prototype.restartReplay_ = function () {
                    this._client && (this._client.stopPreview(), this._client.startPreview(), this.startReplayTimer_())
                }, e.prototype.getPlayer_ = function () {
                    return this._domEle.getElementsByTagName("video").item(0)
                }, e.prototype.updateVideoStatus_ = function (t) {
                    this._lastStatus = t || ";", this._domEle.getElementsByClassName("video-status").item(0).textContent = this._lastStatus
                }, e.prototype.snapshotToCanvas = function () {
                    return r.SnapshotPreview.toCanvas(this.getPlayer_())
                }, e.prototype.snapshotDownload = function () {
                    return r.SnapshotPreview.downloadFile(this.getPlayer_())
                }, e.prototype.refresh = function () {
                    this._client && this.onVideoStream_(this._client.mediaStream)
                }, e.prototype.locate = function (t, e, n, o) {
                    this._client && this._client.locate(t, e, n, o)
                }, e.prototype.control = function (t, e) {
                    void 0 === e && (e = n.PTZSpeed.SPEED_4), this._client && this._client.control(t, e)
                }, e.prototype.stopControl = function () {
                    this._client && this._client.stopControl()
                }, e.prototype.startPreview = function (t, e) {
                    if (void 0 === e && (e = 0), t) {
                        if (this.cameraId === t && this.streamIndex === e) return;
                        this.stopPreview(), this._client = this._vcmgr.getClient(t, e), this._client && (this.startReplayTimer_(), this._client.on(o.VideoClient.EVENT_ONSTREAM, this.onVideoStream_, this), this._client.on(o.VideoClient.EVENT_STATUS, this.onVideoStatus_, this), this.onVideoStream_(this._client.mediaStream))
                    }
                }, e.prototype.onVideoStatus_ = function (t) {
                    this.updateVideoStatus_(t.content), t.code === n.SocStatusCode.unsupportedStream && this.stopReplayTimer_()
                }, e.prototype.onVideoStream_ = function (t) {
                    this.getPlayer_().srcObject = t
                }, e.prototype.stopPreview = function () {
                    this._client && (this._client.off(o.VideoClient.EVENT_ONSTREAM, this.onVideoStream_, this), this._client.off(o.VideoClient.EVENT_STATUS, this.onVideoStatus_, this), this._vcmgr.releaseClient(this._client), this._client = void 0), this._playing = !1, this.stopCheckAlive_(), this.stopReplayTimer_()
                }, e.prototype.close = function () {
                    this.stopPreview()
                }, e.prototype.destroy = function () {
                    this.close(), this._domEle.remove()
                }, e.EVENT_PLAY = "play", e.EVENT_TIME_UPDATE = "timeupdate", e.EVENT_ABORT = "abort", e
            }(i.EventEmitter);
            e.VideoPlayer = a
        }.apply(e, o)) || (t.exports = i)
    }, function (t, e, n) {
        var o, i;
        o = [n, e, n(2)], void 0 === (i = function (t, e, n) {
            "use strict";
            Object.defineProperty(e, "__esModule", {value: !0});
            var o = function () {
                function t() {
                    this._guid = new n.GUID
                }

                return t.toCanvas = function (t) {
                    return this.getInstance_().toCanvas_(t)
                }, t.downloadFile = function (t, e) {
                    this.getInstance_().downloadFile_(t, e)
                }, t.getInstance_ = function () {
                    return t._instance || (t._instance = new t), t._instance
                }, t.prototype.toCanvas_ = function (t) {
                    var e = document.createElement("canvas");
                    return e.width = t.clientWidth, e.height = t.clientHeight, e.getContext("2d").drawImage(t, 0, 0, e.width, e.height), e
                }, t.prototype.downloadFile_ = function (t, e) {
                    var n = this.toCanvas_(t);
                    e ? e.indexOf(".") < 0 && (e += ".jpg") : e = this._guid.newGUID().replace("-", "") + ".jpg";
                    var o = document.createElement("a");
                    o.style.display = "none", o.setAttribute("href", n.toDataURL("image/jpeg")), o.setAttribute("download", e), document.body.appendChild(o), o.click(), o.remove()
                }, t
            }();
            e.SnapshotPreview = o
        }.apply(e, o)) || (t.exports = i)
    }, function (t, e, n) {
        var o, i;
        o = [n, e, n(3)], void 0 === (i = function (t, e, n) {
            "use strict";
            Object.defineProperty(e, "__esModule", {value: !0});
            var o = function () {
                function t(t) {
                    this._rtc = t, this._clients = new Map, this._counter = new Map
                }

                return t.prototype.toKey_ = function (t, e) {
                    return t + "_" + e
                }, t.prototype.increaseCounter_ = function (t) {
                    var e = this._counter.get(t);
                    e || (e = 0), e++, this._counter.set(t, e)
                }, t.prototype.decreaseCounter_ = function (t) {
                    var e = this._counter.get(t);
                    return e ? (0 == --e ? this._counter.delete(t) : this._counter.set(t, e), e) : 0
                }, t.prototype.getClient = function (t, e) {
                    if (t) {
                        e < 0 && (e = 0);
                        var o = this.toKey_(t, e), i = this._clients.get(o);
                        return i || (i = new n.VideoClient(this._rtc, t, e), this._clients.set(o, i), i.startPreview()), this.increaseCounter_(o), i
                    }
                }, t.prototype.releaseClient = function (t) {
                    if (t) {
                        var e = this.toKey_(t.cameraId, t.streamIndex), n = this._clients.get(e);
                        if (n) 0 == this.decreaseCounter_(e) && (this._clients.delete(e), n.stopPreview())
                    }
                }, t
            }();
            e.VideoClientManager = o
        }.apply(e, o)) || (t.exports = i)
    }, function (t, e, n) {
        var o = n(10);
        "string" == typeof o && (o = [[t.i, o, ""]]);
        var i = {hmr: !0, transform: void 0, insertInto: void 0};
        n(12)(o, i);
        o.locals && (t.exports = o.locals)
    }, function (t, e, n) {
        (t.exports = n(11)(!1)).push([t.i, ".lt-video-container {\r\n    position: relative;\r\n    width: 100%;\r\n    height: 100%;\r\n    overflow: hidden;\r\n}\r\n\r\n.lt-video-container video {\r\n    position: absolute;\r\n    width: 100%;\r\n    height: 100%;\r\n    top: 0;\r\n    left: 0;\r\n    object-fit: fill;\r\n}\r\n\r\n.lt-video-container .last-frame {\r\n    position: absolute;\r\n    width: 100%;\r\n    height: 100%;\r\n    pointer-events: none;\r\n}\r\n\r\n.lt-video-container.play .last-frame {\r\n    display: none;\r\n}\r\n\r\n.lt-video-container .video-status {\r\n    position: absolute;\r\n    left: 0;\r\n    bottom: 0;\r\n    color: orange;\r\n}", ""])
    }, function (t, e, n) {
        "use strict";
        t.exports = function (t) {
            var e = [];
            return e.toString = function () {
                return this.map((function (e) {
                    var n = function (t, e) {
                        var n = t[1] || "", o = t[3];
                        if (!o) return n;
                        if (e && "function" == typeof btoa) {
                            var i = (s = o, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(s)))) + " */"),
                                r = o.sources.map((function (t) {
                                    return "/*# sourceURL=" + o.sourceRoot + t + " */"
                                }));
                            return [n].concat(r).concat([i]).join("\n")
                        }
                        var s;
                        return [n].join("\n")
                    }(e, t);
                    return e[2] ? "@media " + e[2] + "{" + n + "}" : n
                })).join("")
            }, e.i = function (t, n) {
                "string" == typeof t && (t = [[null, t, ""]]);
                for (var o = {}, i = 0; i < this.length; i++) {
                    var r = this[i][0];
                    null != r && (o[r] = !0)
                }
                for (i = 0; i < t.length; i++) {
                    var s = t[i];
                    null != s[0] && o[s[0]] || (n && !s[2] ? s[2] = n : n && (s[2] = "(" + s[2] + ") and (" + n + ")"), e.push(s))
                }
            }, e
        }
    }, function (t, e, n) {
        var o, i, r = {}, s = (o = function () {
            return window && document && document.all && !window.atob
        }, function () {
            return void 0 === i && (i = o.apply(this, arguments)), i
        }), a = function (t, e) {
            return e ? e.querySelector(t) : document.querySelector(t)
        }, c = function (t) {
            var e = {};
            return function (t, n) {
                if ("function" == typeof t) return t();
                if (void 0 === e[t]) {
                    var o = a.call(this, t, n);
                    if (window.HTMLIFrameElement && o instanceof window.HTMLIFrameElement) try {
                        o = o.contentDocument.head
                    } catch (t) {
                        o = null
                    }
                    e[t] = o
                }
                return e[t]
            }
        }(), l = null, u = 0, p = [], d = n(13);

        function f(t, e) {
            for (var n = 0; n < t.length; n++) {
                var o = t[n], i = r[o.id];
                if (i) {
                    i.refs++;
                    for (var s = 0; s < i.parts.length; s++) i.parts[s](o.parts[s]);
                    for (; s < o.parts.length; s++) i.parts.push(g(o.parts[s], e))
                } else {
                    var a = [];
                    for (s = 0; s < o.parts.length; s++) a.push(g(o.parts[s], e));
                    r[o.id] = {id: o.id, refs: 1, parts: a}
                }
            }
        }

        function h(t, e) {
            for (var n = [], o = {}, i = 0; i < t.length; i++) {
                var r = t[i], s = e.base ? r[0] + e.base : r[0], a = {css: r[1], media: r[2], sourceMap: r[3]};
                o[s] ? o[s].parts.push(a) : n.push(o[s] = {id: s, parts: [a]})
            }
            return n
        }

        function _(t, e) {
            var n = c(t.insertInto);
            if (!n) throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
            var o = p[p.length - 1];
            if ("top" === t.insertAt) o ? o.nextSibling ? n.insertBefore(e, o.nextSibling) : n.appendChild(e) : n.insertBefore(e, n.firstChild), p.push(e); else if ("bottom" === t.insertAt) n.appendChild(e); else {
                if ("object" != typeof t.insertAt || !t.insertAt.before) throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
                var i = c(t.insertAt.before, n);
                n.insertBefore(e, i)
            }
        }

        function y(t) {
            if (null === t.parentNode) return !1;
            t.parentNode.removeChild(t);
            var e = p.indexOf(t);
            e >= 0 && p.splice(e, 1)
        }

        function v(t) {
            var e = document.createElement("style");
            if (void 0 === t.attrs.type && (t.attrs.type = "text/css"), void 0 === t.attrs.nonce) {
                var o = function () {
                    0;
                    return n.nc
                }();
                o && (t.attrs.nonce = o)
            }
            return m(e, t.attrs), _(t, e), e
        }

        function m(t, e) {
            Object.keys(e).forEach((function (n) {
                t.setAttribute(n, e[n])
            }))
        }

        function g(t, e) {
            var n, o, i, r;
            if (e.transform && t.css) {
                if (!(r = "function" == typeof e.transform ? e.transform(t.css) : e.transform.default(t.css))) return function () {
                };
                t.css = r
            }
            if (e.singleton) {
                var s = u++;
                n = l || (l = v(e)), o = b.bind(null, n, s, !1), i = b.bind(null, n, s, !0)
            } else t.sourceMap && "function" == typeof URL && "function" == typeof URL.createObjectURL && "function" == typeof URL.revokeObjectURL && "function" == typeof Blob && "function" == typeof btoa ? (n = function (t) {
                var e = document.createElement("link");
                return void 0 === t.attrs.type && (t.attrs.type = "text/css"), t.attrs.rel = "stylesheet", m(e, t.attrs), _(t, e), e
            }(e), o = T.bind(null, n, e), i = function () {
                y(n), n.href && URL.revokeObjectURL(n.href)
            }) : (n = v(e), o = P.bind(null, n), i = function () {
                y(n)
            });
            return o(t), function (e) {
                if (e) {
                    if (e.css === t.css && e.media === t.media && e.sourceMap === t.sourceMap) return;
                    o(t = e)
                } else i()
            }
        }

        t.exports = function (t, e) {
            if ("undefined" != typeof DEBUG && DEBUG && "object" != typeof document) throw new Error("The style-loader cannot be used in a non-browser environment");
            (e = e || {}).attrs = "object" == typeof e.attrs ? e.attrs : {}, e.singleton || "boolean" == typeof e.singleton || (e.singleton = s()), e.insertInto || (e.insertInto = "head"), e.insertAt || (e.insertAt = "bottom");
            var n = h(t, e);
            return f(n, e), function (t) {
                for (var o = [], i = 0; i < n.length; i++) {
                    var s = n[i];
                    (a = r[s.id]).refs--, o.push(a)
                }
                t && f(h(t, e), e);
                for (i = 0; i < o.length; i++) {
                    var a;
                    if (0 === (a = o[i]).refs) {
                        for (var c = 0; c < a.parts.length; c++) a.parts[c]();
                        delete r[a.id]
                    }
                }
            }
        };
        var S, E = (S = [], function (t, e) {
            return S[t] = e, S.filter(Boolean).join("\n")
        });

        function b(t, e, n, o) {
            var i = n ? "" : o.css;
            if (t.styleSheet) t.styleSheet.cssText = E(e, i); else {
                var r = document.createTextNode(i), s = t.childNodes;
                s[e] && t.removeChild(s[e]), s.length ? t.insertBefore(r, s[e]) : t.appendChild(r)
            }
        }

        function P(t, e) {
            var n = e.css, o = e.media;
            if (o && t.setAttribute("media", o), t.styleSheet) t.styleSheet.cssText = n; else {
                for (; t.firstChild;) t.removeChild(t.firstChild);
                t.appendChild(document.createTextNode(n))
            }
        }

        function T(t, e, n) {
            var o = n.css, i = n.sourceMap, r = void 0 === e.convertToAbsoluteUrls && i;
            (e.convertToAbsoluteUrls || r) && (o = d(o)), i && (o += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(i)))) + " */");
            var s = new Blob([o], {type: "text/css"}), a = t.href;
            t.href = URL.createObjectURL(s), a && URL.revokeObjectURL(a)
        }
    }, function (t, e) {
        t.exports = function (t) {
            var e = "undefined" != typeof window && window.location;
            if (!e) throw new Error("fixUrls requires window.location");
            if (!t || "string" != typeof t) return t;
            var n = e.protocol + "//" + e.host, o = n + e.pathname.replace(/\/[^\/]*$/, "/");
            return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, (function (t, e) {
                var i, r = e.trim().replace(/^"(.*)"$/, (function (t, e) {
                    return e
                })).replace(/^'(.*)'$/, (function (t, e) {
                    return e
                }));
                return /^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r) ? t : (i = 0 === r.indexOf("//") ? r : 0 === r.indexOf("/") ? n + r : o + r.replace(/^\.\//, ""), "url(" + JSON.stringify(i) + ")")
            }))
        }
    }])
}));